#pragma once
#include "DXAMLCommon.h"

#include "IPALResourceManager.h"
#include "IPALResourceProvider.h"
#include "IPALApplicationDataProvider.h"
#include "CReferenceCount.h"


class CCoreServices;


class ResourceManager :
	public IPALResourceManager,
	public CReferenceCount
{
public: 
	static HRESULT Create(CCoreServices * pCore, ResourceManager * * ppResourceManager);
	virtual ~ResourceManager();
	virtual XUINT32 AddRef();
	virtual XUINT32 Release();
	virtual HRESULT IsLocalResource(struct IPALUri * pUri, XUINT32 * pIsLocalResource);
	virtual HRESULT TryLoadResource(struct IPALUri * pUri, struct IPALMemory * * ppMemory);
	virtual HRESULT TryGetResourceLocation(struct IPALUri * pUri, CXString * * ppResourceLocation);
	virtual HRESULT GetPropertyBag(const CXString & xUid, const struct IPALUri * pBaseUri, xpairlist<xshared_ptr<CXString>,xshared_ptr<CXString> > * * ppPropertyBag);
	virtual HRESULT CombineResourceUri(struct IPALUri * pBaseUri, const CXString * pFragment, struct IPALUri * * ppCombinedUri);
	virtual HRESULT IsAmbiguousUriFragment(const CXString * pUriFragment, XUINT32 * pIsAmbiguous);
	virtual HRESULT CanCacheResource(const struct IPALUri * pUri, XUINT32 * pCanCache);

private: 
	ResourceManager(CCoreServices * pCore, struct IPALResourceProvider * pResourceProvider, struct IPALApplicationDataProvider * pAppDataProvider);
	CCoreServices * m_pCore;
	struct IPALResourceProvider * m_pResourceProvider;
	struct IPALApplicationDataProvider * m_pAppDataProvider;


};



